#define _CRT_SECURE_NO_WARNINGS 1
#pragma once

template<class Iterator,class ref,class ptr>
class _reverse_iterator
{
	typedef _reverse_iterator<Iterator, ref, ptr> self;
public:
	
	_reverse_iterator(const Iterator& it)
		:_it(it)
	{}

	self& operator++()
	{
		--_it;
		return *this;
	}

	self& operator--()
	{
		++_it;
		return *this;
	}

	ref operator*()
	{
		Iterator tmp = _it;
		return *(--tmp);
	}

	ptr operator->()
	{
		return &(operator*());
	}

	bool operator!=(const self& s)
	{
		return _it != s._it;
	}

	bool operator==(const self& s)
	{
		return _it == s._it;
	}

private:
	Iterator _it;
};